//
//  HMNaviViewController.swift
//  webo
//
//  Created by apple on 2016/11/12.
//  Copyright © 2016年 apple. All rights reserved.
//

import UIKit

class HMNaviViewController: UINavigationController {

    override func viewDidLoad() {
        super.viewDidLoad()

    }
    override func pushViewController(_ viewController: UIViewController , animated: Bool) {
        let count = self.childViewControllers.count
        
        if count>0 {
            viewController.hidesBottomBarWhenPushed = true
            if let v = viewController as? HMBaseTableViewController {
                v.navItem.leftBarButtonItem = UIBarButtonItem(title: "返回", imgName: "navigationbar_back", target: self, action: #selector(back))
            }else{
    viewController.navigationItem.leftBarButtonItem = UIBarButtonItem(title: "返回", imgName: "navigationbar_back", target: self, action: #selector(back))
            
            }
            
        }
        
        super.pushViewController(viewController, animated: animated)
//    }
    }
    
  @objc private  func back(){
     popViewController(animated: true)
    }
    
}
